package com.ptt.sqm.component;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.HorizontalScrollView;

public class PagingScrollView extends HorizontalScrollView {

	private ScrollViewListener scrollViewListener = null;

	/**
	 * constructor
	 * 
	 * @param context
	 *            current contex
	 * @param attrs
	 *            AttributeSet
	 * @param defStyle
	 *            style
	 */
	public PagingScrollView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);

		// TODO Auto-generated constructor stub
	}

	/**
	 * constructor
	 * 
	 * @param context
	 *            current contex
	 * @param attrs
	 *            AttributeSet
	 */
	public PagingScrollView(Context context, AttributeSet attrs) {
		super(context, attrs);

	}

	/**
	 * constructor
	 * 
	 * @param context
	 *            current context
	 */
	public PagingScrollView(Context context) {
		super(context);

	}
	
	@Override
	protected void onScrollChanged(int l, int t, int oldl, int oldt) {
		// TODO Auto-generated method stub

		super.onScrollChanged(l, t, oldl, oldt);
		if (scrollViewListener != null) {
			scrollViewListener.onScrollChanged(this, l, t, oldl, oldt);
		}

	}
	
	/**
	 * sets the scrollViewListener
	 * 
	 * @param scrollViewListener
	 */
	public void setScrollViewListener(ScrollViewListener scrollViewListener) {
		this.scrollViewListener = scrollViewListener;
	}

}